Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gltf, converter): make ext-mesh-features independent from ext-structural-metadata #2655

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

mspivak-actionengine
Copy link
Collaborator

@mspivak-actionengine mspivak-actionengine commented Sep 21, 2023

  1. ext-mesh-features is being handled independently from the ext-structural-metadata
  2. fix of incorrect getting data for texture attributes
  3. docs for functions improved
  4. fix comments on previous pr
  5. test for ext-mesh-features added

@dsavinov-actionengine dsavinov-actionengine added the ActionEngine The issue is on ActionEngine controll label Sep 21, 2023
@dsavinov-actionengine dsavinov-actionengine changed the title fix(gltf, converter): make ext-mesh-features independent from ext-str… fix(gltf, converter): make ext-mesh-features independent from ext-structural-metadata Sep 21, 2023
@@ -285,7 +288,7 @@ function getImageValueByCoordinates(
let value: number = 0;
for (const c of channels) {
// We can get the element of CHANNELS_MAP by either index (0, 1, 2, 3) or key (r, g, b, a)
const map = typeof c === "number" ? Object.values(CHANNELS_MAP)[c] : CHANNELS_MAP[c];
const map = typeof c === 'number' ? Object.values(CHANNELS_MAP)[c] : CHANNELS_MAP[c];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type of indexing is messy, is it unavoidable or can we rewrite? I.e. is it mandated by the specs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the EXT_feature_metadata extension specification:
  Channels are labeled by rgba and are swizzled with a string of 1-4 characters.
According to the EXT_mesh_features extension specification:
  The channels array contains non-negative integer values corresponding to channels of the source texture that the feature ID consists of.
  Channels of an RGBA texture are numbered 0–3 respectively.
Function getImageValueByCoordinates is used to process both extensions. 
So, there should be possible to get the element of CHANNELS_MAP by either index (0, 1, 2, 3) or key (r, g, b, a).

I added the comment to the code.

@mspivak-actionengine mspivak-actionengine merged commit 535a7fd into master Sep 21, 2023
@mspivak-actionengine mspivak-actionengine deleted the ms/comments-on-pr2566 branch September 21, 2023 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ActionEngine The issue is on ActionEngine controll
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants